import Vue from 'vue'
import Router from 'vue-router'
import Hello from '@/components/Hello'
import Test from '@/components/Test'
import TestChild1 from '@/components/TestChild1'
import TestChild2 from '@/components/TestChild2'

// 下面的注释是webpack的语法，意思是把 Org.vue 和 Operator.vue 打包为同一个模块
const Org = () => import(/* webpackChunkName: "AAA" */ '../components/org/Org.vue')
const Operator = () => import(/* webpackChunkName: "AAA" */ '../components/Operator.vue')

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Hello',
      component: Hello
    },
    {
      path: '/test',
      component: Test,
      children: [
        {
          path: 'child1',
          component: TestChild1
        },
        {
          path: 'child2',
          component: TestChild2
        }
      ]
    },
    {
      path: '/operator',
      component: Operator
    },
    {
      path: '/org',
      component: Org
    },
    {
      path: '/shopping',
      component: resolve => require(['@/components/shopping/Shopping'], resolve)
    }
  ]
})
